
var Moderators = {
    
    init: function() {
        this.bindNavBtns();
        this.bindListBtns();
    },
    
    bindNavBtns: function() {
        $("#add_moderators").click(function(e) {
            e.preventDefault();
            
            var url = $(this).attr("href");
            
            Jlib.openInDialog(url, {
                title: 'Add Moderators',
                height: 460,
                buttons: {
                    'Add Moderator': function() {
                        Jlib.submitDialog();
                    },
                    'Cancel': function() {
                        Jlib.closeDialog();
                    }
                },
                close: function() {
                    window.history.go(0);
                }
            });
        });
    },
    
    bindListBtns: function() {
        $(".edit_link").click(function(e) {
            e.preventDefault();
            
            var url = $(this).attr('href');
            
            Jlib.openInDialog(url, {
                title: 'Edit Moderator Information',
                height: 460,
                buttons: {
                    'Save Changes': function() {
                        Jlib.submitDialog();
                    },
                    'Cancel': function() {
                        Jlib.closeDialog();
                    }
                },
                close: function() {
                    window.history.go(0);
                }
            });
        });
    }
};

$(document).ready(function() {
    Moderators.init();
});